<!DOCTYPE html>
<html lang="zh">
    <head></head>
    <body class="hold-transition sidebar-mini">
        <div class="wrapper">
            <nav class="main-header navbar navbar-expand bg-white navbar-light border-bottom"></nav>
            <aside class="main-sidebar sidebar-dark-primary elevation-4"></aside>
            <div class="content-wrapper">
                <div class="content-header">
                    <div class="container-fluid"></div>
                </div>
                <div id="content-panel" class="content">

                    <div class="container-fluid">
                        <div class="card card-primary card-outline">
                            <div class="card-header">
                                <h3 class="card-title">分类管理</h3>
                            </div>
                            <div class="card-body">
                                <div class="grid-btn">
                                    <button class="btn btn-info" onclick="categoryAdd()">
                                        <i class="fa fa-plus"></i>&nbsp;新增
                                    </button>
                                    <button class="btn btn-info" onclick="categoryEdit()">
                                        <i class="fa fa-pencil-square-o"></i>&nbsp;修改
                                    </button>
                                    <button class="btn btn-danger" onclick="deleteCagegory()">
                                        <i class="fa fa-trash-o"></i>&nbsp;删除
                                    </button>
                                </div>
                                <br>
                                <table id="category-jqGrid" class="table table-bordered"></table>
                                <div id="category-jqGridPager"></div>
                            </div>
                        </div>
                    </div>

                    <div class="modal fade" id="categoryModal" tabindex="-1" role="dialog"
                         aria-labelledby="categoryModalLabel">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                            aria-hidden="true">&times;</span></button>
                                    <h6 class="modal-title" id="categoryModalLabel">Modal</h6>
                                </div>
                                <div class="modal-body">
                                    <form id="categoryForm">
                                        <input type="hidden" class="form-control" id="categoryId" name="categoryId">
                                        <div class="form-group">
                                            <label for="categoryName" class="control-label">分类名称:</label>
                                            <input type="text" class="form-control" id="categoryName"
                                                   name="categoryName"
                                                   placeholder="请输入分类名称" required="required">
                                        </div>
                                        <div class="form-group">
                                            <label for="categoryIcon" class="control-label">分类图标:</label>
                                            <select class='form-control select2 image-picker' id="categoryIcon"
                                                    name="categoryIcon">
                                                <option data-img-src='/admin/dist/img/category/00.png'
                                                        value='/admin/dist/img/category/00.png'> 默认图标
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/01.png'
                                                        value='/admin/dist/img/category/01.png'> 图标1
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/02.png'
                                                        value='/admin/dist/img/category/02.png'> 图标2
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/03.png'
                                                        value='/admin/dist/img/category/03.png'> 图标3
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/04.png'
                                                        value='/admin/dist/img/category/04.png'> 图标4
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/05.png'
                                                        value='/admin/dist/img/category/05.png'> 图标5
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/06.png'
                                                        value='/admin/dist/img/category/06.png'> 图标6
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/07.png'
                                                        value='/admin/dist/img/category/07.png'> 图标7
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/08.png'
                                                        value='/admin/dist/img/category/08.png'> 图标8
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/09.png'
                                                        value='/admin/dist/img/category/09.png'> 图标9
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/10.png'
                                                        value='/admin/dist/img/category/10.png'> 图标10
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/11.png'
                                                        value='/admin/dist/img/category/11.png'> 图标11
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/12.png'
                                                        value='/admin/dist/img/category/12.png'> 图标12
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/13.png'
                                                        value='/admin/dist/img/category/13.png'> 图标13
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/14.png'
                                                        value='/admin/dist/img/category/14.png'> 图标14
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/15.png'
                                                        value='/admin/dist/img/category/15.png'> 图标15
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/16.png'
                                                        value='/admin/dist/img/category/16.png'> 图标16
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/17.png'
                                                        value='/admin/dist/img/category/17.png'> 图标17
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/18.png'
                                                        value='/admin/dist/img/category/18.png'> 图标18
                                                </option>
                                                <option data-img-src='/admin/dist/img/category/19.png'
                                                        value='/admin/dist/img/category/19.png'> 图标19
                                                </option>
                                            </select>
                                        </div>
                                    </form>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                    <button type="button" class="btn btn-primary" id="saveButton">确认</button>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <footer class="main-footer"></footer>
        </div>
        <script src="/admin/plugins/jquery.min.js"></script>

        <script src="/admin/plugins/js.cookie.min.js"></script>

        <script src="/admin/plugins/jquery-ui.min.js"></script>

        <script src="/admin/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>

        <script src="/admin/plugins/adminlte/adminlte.min.js"></script>

        <script src="/admin/plugins/jqgrid-5.3.0/jquery.jqGrid.min.js"></script>
        <script src="/admin/plugins/jqgrid-5.3.0/grid.locale-cn.js"></script>

        <script src="/admin/plugins/image-picker/jquery.masonry.min.js"></script>
        <script src="/admin/plugins/image-picker/image-picker.min.js"></script>
        <script src="/admin/plugins/layer/layer.js"></script>

        <script src="/admin/dist/js/public.js"></script>
        <script src="/admin/dist/js/base.js"></script>
        <script src="/admin/dist/js/category.js"></script>

        <script>
            $(function () {
                // 加载head标签内容
                $("head").load("/admin/templates/head.html");
                $("nav").load("/admin/templates/navigation.html");
                $("aside").load("/admin/templates/sidebar.html", function () {
                    let name = Cookies.get("nickName");
                    $("#userNick").text(name);
                    clearActive();
                    $("#ul-item-5").attr("class", "nav-link active");
                });
                manageCategory();
                $("footer").load("/admin/templates/footer.html");

                jQuery("select.image-picker").imagepicker({
                    hide_select: false,
                });

                jQuery("select.image-picker.show-labels").imagepicker({
                    hide_select: false,
                    show_label: true,
                });
                $(window).resize(function () {
                    $("#category-jqGrid").setGridWidth($(".card-body").width());
                });
                var container = jQuery("select.image-picker.masonry").next("ul.thumbnails");
                container.imagesLoaded(function () {
                    container.masonry({
                        itemSelector: "li",
                    });
                });
            });
        </script>
    </body>
</html>